<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>10_闭包-坑点2</title>
    </head>
    <body>
        <script>
            // function f1(){
            //     var a = 1;
            //     a++;
            //     console.log(a);
            // }

            // f1();
            // f1();
            // f1();
            // f1();

            function f1(){
                var a = 1;
                function f2(){
                    a++;
                    console.log(a);
                }
                return f2;
            }

            var result = f1();
            result();
            result();
            result();
            result();

            result = null;

            result();


        </script>
    </body>
</html>